import sympy as sym
import numpy as np
sym.init_printing()
#document:https://github.com/sympy/sympy


def mrdivide(arg_a, arg_b, flag = True):
    if flag :
        return sym.simplify(np.linalg.lstsq(np.array(arg_a), np.array(arg_b), rcond=None)[0])
    else:
        return np.linalg.lstsq(np.array(arg_b), np.array(arg_a), rcond=None)[0]
    


a = [[ 1, 1,  1,  1],
[ 1, 2,  3,  4],
[ 1, 3,  6, 10],
[ 1, 4, 10, 20]]
 
b = [[4], [3], [2], [1]]



res6 = mrdivide(a, b)
print(res6)


